package com.anrongtec.zcpt.base;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.anrongtec.zcpt.ApiConfig;
import com.anrongtec.zcpt.R;
import com.sdsmdg.tastytoast.TastyToast;


/**
 * A simple {@link Fragment} subclass.
 */
public class BaseFragment extends Fragment {


    public BaseFragment() {
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_base, container, false);
    }

    /**
     * Toast的5种状态使用
     * @param text
     * @param type
     */
    protected void showToastCustom(String text, int type){
        switch (type){
            case ApiConfig.SUCCESS:
                TastyToast.makeText(getActivity(),text, TastyToast.LENGTH_SHORT, TastyToast.SUCCESS);
                break;
            case ApiConfig.ERROR:
                TastyToast.makeText(getActivity(),text, TastyToast.LENGTH_SHORT, TastyToast.ERROR);
                break;
            case ApiConfig.WARNING:
                TastyToast.makeText(getActivity(),text, TastyToast.LENGTH_SHORT, TastyToast.WARNING);
                break;
            case ApiConfig.INFO:
                TastyToast.makeText(getActivity(),text, TastyToast.LENGTH_SHORT, TastyToast.INFO);
                break;
            case ApiConfig.DEFAULT:
                TastyToast.makeText(getActivity(),text, TastyToast.LENGTH_SHORT, TastyToast.DEFAULT);
                break;
        }
    }

}
